package cn.yunzhisheng.vui.assistant.tv;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import cn.yunzhisheng.vui.assistant.tv.talk.TalkService;

public class MessageReceiver extends BroadcastReceiver {
    public static final String ACTION_VIRTUAL_KEY_SERVER = "cn.yunzhisheng.intent.virtualKeyServer";

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
            Intent i = new Intent(context, TalkService.class);
            context.startService(i);

            Intent windowIntent = new Intent(context, WindowService.class);
            context.startService(windowIntent);

            Intent vritualKey = new Intent(ACTION_VIRTUAL_KEY_SERVER);
            context.startService(vritualKey);
        } else if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
            intent.setClass(context, WindowService.class);
            context.stopService(intent);
            // abortBroadcast();
        }
    }
}
